// <copyright file="MenuButtonItem.cs" company="YUIAsp.Net">
// Copyright (c) 2009 All Right Reserved
// </copyright>
// <author>raul popescu</author>
// <email>dev@yuiasp.net</email>
// <date>2009-01-30</date>
// <summary>YUIAsp.Net File</summary>

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing.Design;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace YUIAspNet
{
    [ParseChildren(true)]
    [Serializable]
    [ToolboxItem(false)]
    public class MenuButtonItem
    {
        public MenuButtonItem(): this(null, null) { }

        public MenuButtonItem(string text, string value)
        {
            this.Text = text;
            this.Value = value;

            this.Enabled = true;
            this.AutoPostback = true;
        }

        /// <summary>
        /// Get or set the display text/html
        /// </summary>
        public string Text { get; set; }

        /// <summary>
        /// Get or set the value of the item.
        /// </summary>
        public string Value { get; set; }

        /// <summary>
        /// Get or set the target of the hyperlink.
        /// Only took into account if the NavigateURL property has also been set.
        /// </summary>
        [DefaultValue(""), TypeConverter(typeof(TargetConverter))]
        public string Target { get; set; }

        /// <summary>
        /// Get or set the url of the control. 
        /// If this property is set, the item will act as a HyperLink
        /// </summary>
        [Bindable(true), DefaultValue(""), UrlProperty, Editor("System.Web.UI.Design.UrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
        public string NavigateUrl { get; set; }

        /// <summary>
        /// Sub-menu items.
        /// </summary>
        [
            Category("Data"), 
            Description("Button options."),
            PersistenceMode(PersistenceMode.InnerProperty)
        ]
        public List<MenuButtonItem> SplitButtonOptions { get; set; }

        public bool Selected { get; set; }

        public bool Checked { get; set; }

        public string CssClass { get; set; }

        public bool Enabled { get; set; }

        public string OnClientClick { get; set; }

        public bool AutoPostback { get; set; }
    }
}
